package com.rf.HelloSpringBoot.Controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.rf.HelloSpringBoot.repository.VisitorRepository;

/**
 * 
 * @author linzhengchun
 *
 * 2017年7月19日 下午11:10:31
 */
@RestController
public class HelloTemplateController {
	
	@Autowired
	private VisitorRepository visitorRepo;
	
//	@RequestMapping(value = "/helloTemplate", method = RequestMethod.GET)
//	public String sayHello () {
//		return "Hello Spring Boot ~";
//	}
	
	@GetMapping(value = "/helloTable")
	public Map<String, Object> sayHelloTable () {
		Map<String, Object> tableData = new HashMap();
		tableData.put("list", this.visitorRepo.findAll());
		tableData.put("count", 3);
		return tableData;
	}
}
